package test_achieve.courierapp;


import constant.Constant;
import constant.IdCard;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import util.tools.BusinessTools;
import util.tools.CommonTools;

/**
 * Created by chenkuo on 2017/8/16.
 */
public class Courier {
    public static void couierLogin(String number) throws Throwable {
        CommonTools.waitElementLoad(Constant.driverCourier,"id","com.ishansong:id/pwd_login_mobile_et");
        Constant.driverCourier.findElement(By.id("com.ishansong:id/pwd_login_mobile_et")).sendKeys(number);//输入手机号
        Constant.driverCourier.findElement(By.id("com.ishansong:id/pwd_login_pwd_et")).sendKeys("888888");//输入密码
        Constant.driverCourier.findElement(By.id("com.ishansong:id/login_btn")).click();//点击登录按钮
        System.out.println(IdCard.map.get(number));
        Thread.sleep(9000);
        if (CommonTools.checkElementExit(Constant.driverCourier,"id", "com.ishansong:id/login_idcard_et")) {
            WebElement card = Constant.driverCourier.findElement(By.id("et_id_card"));
            card.sendKeys(IdCard.map.get(number));
            Constant.driverCourier.findElement(By.id("login_btn")).click();//点击登录按钮
        }
        CommonTools.waitElementLoad(Constant.driverCourier, "id","title_txt");//中间闪送2个字
        BusinessTools.checkEvn(number);

    }




}
